package game;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
/*
 * Team: Sting Arrays
 * Creators: Devin La Fleur. and Jonathan Satchell.
 * Game: Defend Chernobly
 */
public class Instructions extends JFrame {



	public Instructions() {
		JPanel contentPane;
		getContentPane().setLayout(null);
		this.setBounds(new Rectangle(800,600));
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 800, 600);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(null);
		setContentPane(contentPane);

		JLabel lblInstructions = new JLabel("Instructions:");
		lblInstructions.setFont(new Font("OCR A Extended", Font.PLAIN, 28));
		lblInstructions.setBounds(35, 28, 239, 52);
		contentPane.add(lblInstructions);

		JLabel lblNewLabel = new JLabel("The Chernobyl Reactor has just exploded and now all the mutants that were created by the radiation are coming to take over the facility.");
		lblNewLabel.setVerticalAlignment(SwingConstants.TOP);
		lblNewLabel.setBounds(10, 91, 764, 14);
		contentPane.add(lblNewLabel);

		JLabel lblNewLabel_1 = new JLabel("For some reason Matt Damon was already at the reactor and somehow was not affected by the radiation. Because he is Matt Damon,");
		lblNewLabel_1.setBounds(10, 103, 764, 14);
		contentPane.add(lblNewLabel_1);

		JLabel lblBecauseHeIs = new JLabel("someone hired him to kill all the mutants before the reactor is completely overrun. Yes, he gets paid for every mutant he kills.");
		lblBecauseHeIs.setBounds(10, 116, 764, 14);
		contentPane.add(lblBecauseHeIs);

		JLabel lblNewLabel_2 = new JLabel("This is where you come in. You are Matt Damon. (How many people get to say that huh? Just Matt Damon. And you for however long you play this game.)");
		lblNewLabel_2.setBounds(10, 128, 764, 14);
		contentPane.add(lblNewLabel_2);

		JLabel lblNewLabel_3 = new JLabel("1. You will begin with a pistol and no reinforcements to your camp at the top of the reactor. Click the mutants to shoot them and try to survive the day!");
		lblNewLabel_3.setBounds(10, 167, 764, 14);
		contentPane.add(lblNewLabel_3);

		JLabel lblNewLabel_4 = new JLabel("2. The mutants will advance towards your reactor, kill them before they reach it!");
		lblNewLabel_4.setBounds(10, 192, 742, 14);
		contentPane.add(lblNewLabel_4);

		JLabel lblNewLabel_5 = new JLabel("The Three-Eyed-Fish will go down the easiest");
		lblNewLabel_5.setBounds(67, 217, 342, 14);
		contentPane.add(lblNewLabel_5);

		JLabel lblNewLabel_6 = new JLabel("The Mound-O-Frogs will do slightly more damage");
		lblNewLabel_6.setBounds(67, 242, 539, 14);
		contentPane.add(lblNewLabel_6);

		JLabel lblNewLabel_7 = new JLabel("Finally, Godzilla will do much more damage.");
		lblNewLabel_7.setBounds(67, 267, 529, 14);
		contentPane.add(lblNewLabel_7);

		JLabel lblNewLabel_8 = new JLabel("3. The day ends when you have killed all the mutants for a certain span of time. At the end of the day you will be given choices to upgrade.");
		lblNewLabel_8.setBounds(10, 296, 742, 14);
		contentPane.add(lblNewLabel_8);

		JLabel lblYourReinforcementsAnd = new JLabel("You can upgrade reinforcements and weapons with the money you have earned.");
		lblYourReinforcementsAnd.setBounds(20, 321, 670, 14);
		contentPane.add(lblYourReinforcementsAnd);

		JLabel lblNewLabel_9 = new JLabel("4. Continue to fight and upgrade until you cannot survive the day.");
		lblNewLabel_9.setBounds(10, 354, 499, 14);
		contentPane.add(lblNewLabel_9);

		JButton btnMainMenu = new JButton("Main Menu");
		btnMainMenu.addActionListener(new Instructions_btnMainMenu_actionAdapter(this));
		btnMainMenu.setBounds(35, 528, 89, 23);
		contentPane.add(btnMainMenu);
	}
	public void btnMainMenu_actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub

		this.setVisible(false);
		Menu menu = new Menu();

        // Center the window
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = menu.getSize();
        if (frameSize.height > screenSize.height) {
            frameSize.height = screenSize.height;
        }
        if (frameSize.width > screenSize.width) {
            frameSize.width = screenSize.width;
        }
        menu.setLocation((screenSize.width - frameSize.width) / 2,
                          (screenSize.height - frameSize.height) / 2);
        menu.setVisible(true);
	}
}

class Instructions_btnMainMenu_actionAdapter implements ActionListener {
	private Instructions adaptee;
    Instructions_btnMainMenu_actionAdapter(Instructions adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.btnMainMenu_actionPerformed(e);
    }

}
